#ifndef __ACCEPTOR_H__
#define __ACCEPTOR_H__
#include "Socket.h"
#include "InetAddr.h"

class Acceptor
{
public:
    Acceptor(const string &ip, unsigned short port);
    ~Acceptor();
    void ready();//执行地址端口复用\bind\listen
    int accept();//处理新连接

    int fd();
private:
    void setReuseAddr();
    void setReusePort();
    void setNonBlocking();
    void bind();
    void listen();

private:
    Socket _sock;
    InetAddr _addr;
};
#endif
